﻿using System.Reflection;
using Abp.Configuration.Startup;
using Abp.Localization.Dictionaries;
using Abp.Localization.Dictionaries.Xml;
using Abp.Localization.Sources;
using Abp.Reflection.Extensions;

namespace KelonProud.Localization
{
    public static class KelonProudLocalizationConfigurer
    {
        public static void Configure(ILocalizationConfiguration localizationConfiguration)
        {
            localizationConfiguration.Sources.Add(
                new DictionaryBasedLocalizationSource(KelonProudConsts.LocalizationSourceName,
                    new XmlEmbeddedFileLocalizationDictionaryProvider(
                        typeof(KelonProudLocalizationConfigurer).GetAssembly(),
                        "KelonProud.Localization.SourceFiles"
                    )
                )
            );

            localizationConfiguration.Sources.Extensions.Add(
                new LocalizationSourceExtensionInfo("AbpWeb",
                    new XmlEmbeddedFileLocalizationDictionaryProvider(
                        Assembly.GetExecutingAssembly(),
                        "KelonProud.Localization.AbpWebXmlSource"
                    )
                )
            );

            localizationConfiguration.Languages.Add(
                new Abp.Localization.LanguageInfo("zh-CN", "中文")
            );
        }
    }
}
